home *** CD-ROM | disk | FTP | other *** search
- #include <tosdefs.h>
- #include <osbind.h>
-
- #define FALSE 0
- #define TRUE 1
-
- extern long *_base;
- extern my_gemdos();
-
- int (*sys_gemdos)();
-
- #ifdef DEBUG
- #define FDEBUG
- #define EXEC
- #endif
-
- static char bugbuf[132];
-
- static char pathbuf[256];
-
- char *xlatpath(s)
- register char *s;
- {
- register char *p;
-
- for (p = pathbuf; *s; p++)
- if ((*p = *s++) == '/')
- *p = '\\';
- *p = 0;
- return(pathbuf);
- }
-
- xlatarg(path)
- char **path;
- {
- *path = xlatpath(*path);
- }
-
- struct exec_frame {
- int ef_mode;
- char *ef_path;
- char *ef_tail;
- char *ef_env;
- };
- extern long xexec();
-
- pexec(pf)
- struct exec_frame *pf;
- {
- pf->ef_path = xlatpath(pf->ef_path);
- }
-
- frename(p)
- struct {
- int fr_n;
- char *fr_old;
- char *fr_new;
- } *p;
- {
- static char path1[256];
-
- strcpy(path1, xlatpath(p->fr_old));
- p->fr_old = path1;
- p->fr_new = xlatpath(p->fr_new);
- }
-
- /*
- ***************** END OF GEMDOS HANDLERS ***************
- */
-
-
- /*
- * dispatch GEMDOS function
- */
-
- do_gemdos(n, p)
- int n;
- char *p;
- {
- #ifdef PALL
- if (n != 0xb) {
- sprintf(bugbuf, "BDOS: '%s' %02x\n\r", runningpcb->name, n);
- bugws(bugbuf);
- }
- #endif
- switch (n) {
- case 0x3b: /* 3b Dsetpath */
- case 0x3c: /* 3c Fcreate */
- case 0x3d: /* 3d Fopen */
- case 0x41: /* 41 Fdelete */
- case 0x4e: /* 4e Fsfirst */
- xlatarg(p);
- break;
- case 0x4b: /* 4b Pexec */
- pexec(p);
- break;
- case 0x56: /* 56 Frename */
- frename(p);
- break;
- }
- }
-
-
- bugws(s)
- char *s;
- {
- while (*s)
- Bconout(2, *s++);
- }
-
-
- main()
- {
- Cconws("Slashman - Path Translator.\r\n(C) 1992 David Beckemeyer\r\nFREEWARE\r\n");
- sys_gemdos = Setexc(0x21, my_gemdos);
- Ptermres((long)(_base[3] + _base[5] + _base[7] + 0x100L), 0);
- Setexc(0x21, sys_gemdos);
- }
-